cmake_minimum_required(VERSION 3.5 FATAL_ERROR) # CMake version check
project(recipe_08 VERSION 0.1 LANGUAGES CXX)

message(STATUS "C++ compiler flag: ${CMAKE_CXX_COMPILER_FLAGS}")

list(APPEND flags "-fPIC" "-Wall")
if (NOT WIN32)
    list(APPEND flags "-Wextra" "-Wpedantic")
endif()

add_library(geometry STATIC 
            include/geometryCircle.hpp 
            include/geometrySquare.hpp 
            include/geometryPolygon.hpp
            include/geometryRhombus.hpp
            src/geometryCircle.cpp 
            src/geometrySquare.cpp
            src/geometryPolygon.cpp
            src/geometryRhombus.cpp)

target_compile_options(geometry PRIVATE ${flags})

add_executable(compute-areas helloWorld.cpp src/message.cpp) # 添加message.cpp
target_compile_options(compute-areas PRIVATE "-fPIC")
target_link_libraries(compute-areas geometry)